using UnityEngine;

public class SkillProvider
{
	public SkillConfig skillConfig = SkillConfig.OriginalPlayerConfig();

	public PlayerStatsManager.SkillType[] displaySkills
	{
		get
		{
			return skillConfig.displaySkills;
		}
	}

	public string GetSkillValueCountString(int skillTypeIndex, float gain = 0f)
	{
		float num = GetSkillValue(skillTypeIndex) + gain;
		num *= 100f;
		return Mathf.FloorToInt(num).ToString();
	}

	public float GetFillProgress(int skillTypeIndex, float gain = 0f)
	{
		return (GetSkillValue(skillTypeIndex) + gain) / 60f;
	}

	public virtual float GetSkillValue(int skillTypeIndex)
	{
		SkillDescription skillDescrption = skillConfig.GetSkillDescrption(skillTypeIndex);
		bool flag = skillDescrption != null && skillDescrption.isComposite;
		float num = 0f;
		if (flag)
		{
			return Mathf.Max(DoGetSkillValue(skillTypeIndex), GetCompositeSkillValue(skillDescrption));
		}
		return DoGetSkillValue(skillTypeIndex);
	}

	public virtual float GetCompositeSkillValue(SkillDescription skillDesc)
	{
		float num = 0f;
		PlayerStatsManager.SkillType[] compositeList = skillDesc.compositeList;
		foreach (PlayerStatsManager.SkillType skillTypeIndex in compositeList)
		{
			num += GetSkillValue((int)skillTypeIndex);
		}
		return num / (float)skillDesc.compositeList.Length;
	}

	public virtual float DoGetSkillValue(int skillTypeIndex)
	{
		return 0f;
	}
}
